<template>
  <div class="platform-transaction-code">
    <div class="content-wrapper">
      <!-- 左侧内容 -->
      <div class="left-content">
        <div class="title-section">
          <h2 class="main-title">
            <el-icon class="title-icon"><Grid /></el-icon>
            平台交易码
          </h2>
          <h3 class="sub-title">快捷交易,一码搞定</h3>
          <p class="description">
            平台交易码是吕欣华中菌业交易平台提供的便捷交易工具,扫描交易码即可快速进行平台内交易。
          </p>
          <button class="apply-btn" @click="handleApplyCode">
            <el-icon class="btn-icon"><Grid /></el-icon>
            申请专属交易码
          </button>
        </div>
      </div>

      <!-- 右侧内容 -->
      <!-- <div class="right-content">
        <div class="qr-section">
          <div class="qr-header">
            <h3>平台交易码</h3>
            <a href="#" class="guide-link" @click="handleGuideClick">使用指南</a>
          </div>
          <div class="qr-code">
            <div class="qr-placeholder">
              <div class="qr-grid">
                <div v-for="i in 25" :key="i" class="qr-dot"></div>
              </div>
            </div>
          </div>
        </div>
      </div> -->
    </div>
  </div>
</template>

<script setup lang="ts">
import { Grid } from '@element-plus/icons-vue'

// 这里可以添加相关的逻辑，比如生成二维码、申请交易码等
const handleApplyCode = () => {
  console.log('申请专属交易码')
  // 这里可以添加申请交易码的逻辑
}

const handleGuideClick = () => {
  console.log('查看使用指南')
  // 这里可以添加跳转到使用指南的逻辑
}
</script>

<style scoped lang="scss">
.platform-transaction-code {
  background-color: #ffffff;
  padding: 40px 0;
  margin: 20px 0;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);

  .content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    background: url('~/assets/images/trade-code-bg.png') no-repeat center right;
    background-size: cover;
    border-radius: 12px;
    padding: 40px;
    min-height: 300px;
    position: relative;

    &::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.8) 60%,
        rgba(255, 255, 255, 0.3) 100%
      );
      border-radius: 12px;
      z-index: 1;
    }

    > * {
      position: relative;
      z-index: 2;
    }
  }

  .left-content {
    flex: 1;
    padding-right: 40px;

    .title-section {
      .main-title {
        font-size: 28px;
        font-weight: 700;
        color: #333;
        margin: 0 0 10px 0;
        display: flex;
        align-items: center;
        gap: 8px;

        .title-icon {
          font-size: 24px;
          color: #e93323;
        }
      }

      .sub-title {
        font-size: 24px;
        font-weight: 600;
        color: #1890ff;
        margin: 0 0 20px 0;
        line-height: 1.3;
      }

      .description {
        font-size: 16px;
        color: #666;
        line-height: 1.6;
        margin: 0 0 30px 0;
        max-width: 500px;
      }

      .apply-btn {
        background: #e93323;
        color: #fff;
        border: none;
        padding: 12px 30px;
        border-radius: 6px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 8px;

        .btn-icon {
          font-size: 18px;
        }

        &:hover {
          background: #ff7875;
          transform: translateY(-2px);
          box-shadow: 0 4px 12px rgba(255, 77, 79, 0.3);
        }

        &:active {
          transform: translateY(0);
        }
      }
    }
  }

  .right-content {
    flex: 0 0 280px;
    display: flex;
    justify-content: center;
    align-items: center;

    .qr-section {
      background: #fff;
      border-radius: 12px;
      padding: 30px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
      text-align: center;

      .qr-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;

        h3 {
          font-size: 18px;
          font-weight: 600;
          color: #333;
          margin: 0;
        }

        .guide-link {
          color: #1890ff;
          text-decoration: none;
          font-size: 14px;
          transition: color 0.3s ease;

          &:hover {
            color: #40a9ff;
            text-decoration: underline;
          }
        }
      }

      .qr-code {
        .qr-placeholder {
          width: 200px;
          height: 200px;
          background: #f5f5f5;
          border: 2px solid #e8e8e8;
          border-radius: 8px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin: 0 auto;

          .qr-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 3px;
            width: 150px;
            height: 150px;

            .qr-dot {
              background: #333;
              border-radius: 2px;
              opacity: 0.8;

              &:nth-child(odd) {
                opacity: 0.4;
              }
            }
          }
        }
      }
    }
  }
}

// 响应式设计
@media (max-width: 1200px) {
  .platform-transaction-code {
    .content-wrapper {
      flex-direction: column;
      text-align: center;
      padding: 30px 20px;

      .left-content {
        padding-right: 0;
        margin-bottom: 30px;

        .title-section {
          .description {
            max-width: 100%;
          }
        }
      }
    }
  }

  .right-content {
    flex: none;
  }
}

@media (max-width: 768px) {
  .platform-transaction-code {
    .content-wrapper {
      padding: 20px 15px;

      .left-content {
        .title-section {
          .main-title {
            font-size: 24px;
          }

          .sub-title {
            font-size: 20px;
          }

          .description {
            font-size: 14px;
          }

          .apply-btn {
            padding: 10px 24px;
            font-size: 14px;
          }
        }
      }

      .right-content {
        .qr-section {
          padding: 20px;

          .qr-code .qr-placeholder {
            width: 150px;
            height: 150px;

            .qr-grid {
              width: 120px;
              height: 120px;
            }
          }
        }
      }
    }
  }
}
</style>
